package com.njwb.day01;

public class Test04 {
    public static void main(String[] args) {
        //算数运算符 + - * / %
        int i=10;
        int j=20;
        int result=i+j;
        System.out.println(result);
        result=i+10;
        System.out.println(result);
        result=i-j;
        System.out.println(result);
        result=i*j;
        System.out.println(result);
        result=i/j;
        System.out.println(result);
        int k=1;
        result=k/3;
        System.out.println(result);
        System.out.println();
        int x=10;
        double d=1.3;
        result=(int)(x+d);//x+d-->double
        System.out.println(result);
        result=x+(int)d;
        System.out.println(result);
        //+= -= *= /= %=
        x+=d;// x=x+(int)d
        System.out.println(x);
        System.out.println();
        //++ --
        int ii=1;
        ++ii;//ii=ii+1
        ii++;//ii=ii+1
        System.out.println(ii);//3
        System.out.println();
        ii=1;
        System.out.println(++ii);//2 先+1后使用
        System.out.println(ii);//2
        System.out.println(ii++);//2 先使用后+1
        System.out.println(ii);//3
        System.out.println();
        i=3;
        i=3+1;// i 4
        i++;// i 5
        System.out.println(i++);//5 i 6
        ++i;//i 7
        i+=3;//i 10
        i--;//i 9
        System.out.println(--i);//8 i 8
        System.out.println(i);//8
        System.out.println();
        //比较运算符>  <   <=  <=  !=  ==
        int a=1;
        int b=2;
        System.out.println(a>b);//false
        System.out.println(a<b);//true
        System.out.println(a<=b);//true
        System.out.println(a>=b);//false
        System.out.println(a!=b);//true
        System.out.println(a==b);//false
        System.out.println();
        System.out.println(a+1>=b);//true
        System.out.println(b-a==a);//true
        System.out.println(1+1==b);//true
        System.out.println();
        //逻辑运算符 && ||
        //表达式1&&表达式2:当表达式1不成立时直接返回false不执行表达式2
        //表达式1||表达式2：当表达式1成立时直接返回true不执行表达式2
        a=10;
        b=20;
        System.out.println(a<b&&a>b);//true&&false=false
        System.out.println(a<b||a>b);//true||false=true
        String str=null;
        System.out.println(a>b&&str.equals("abc"));//false
        //System.out.println(Node<b&&str.equals("abc"));//true&&报错
        //System.out.println(str.equals("abc")&&Node>b);//报错
        //System.out.println(Node>b||str.equals("abc"));//报错
        System.out.println(a<b||str.equals("abc"));//true







    }
}
